<extend name="Public/base" />
<block name="body">
    <div class="main-title">
        <h2><present name="data">[ {$data.title} ] 子</present>文章列表 </h2>
    </div>
    <div class="cf">
        <a class="btn" href="{:U('addnotice',array('a_type'=>'add'))}">新 增</a>
        <div class="search-form fr cf">
            <div class="sleft">
                <form action="__SELF__" method="post">
                    <input type="text" name="keyword" placeholder="请输入标题或内容">
                    <select name="area">
                    <option value="" >选择地区</option>
                        <volist name="areas" id="v">
                            <option value="{$v.areaID}" <if condition="$data.area_id eq $v['areaID']">selected</if>>{$v.area}</option>
                        </volist>
                    </select>
                    <input type="date" name="start">
                    <input type="date" name="end">
                    <input type="submit" name="">
                </form>
            </div>
        </div>
    </div>
    <div class="data-table table-striped">
        <form class="ids">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>ID</th>
                        <th>地区</th>
                        <th>标题</th>
                        <th>内容</th>
                        <th>创建时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <notempty name="list">
                        <volist name="list" id="vo">
                            <tr>
                                <td>
                                    <input class="ids row-selected" type="checkbox" name="id[]" value="{$menu.id}">
                                </td>
                                <td>{$vo.id}</td>
                                <td>{$vo.area_name}</td>
                                <td>{$vo.title}</td>
                                <td>{$vo.content}</td>
                                <td>{$vo.ctime|date='Y-m-d ',###}</td>
                                <td>
                                    <if condition="$vo.status eq 0">
                                        未签到
                                    </if>
                                    <if condition="$vo.status eq 1">
                                        已签到
                                    </if>
                                    
                                </td>
                                <td>
                                    <a title="编辑" href="{:U('editnotice',array('id'=>$vo['id']))}">编辑</a>
                                    <a class="confirm ajax-get" title="删除" href="{:U('del?id='.$vo['id'])}">删除</a>
                                </td>
                            </tr>
                        </volist>
                        <else/>
                        <td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
                    </notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
        </div>
    </div>
</block>
<block name="script">
    <script type="text/javascript">
    $(function() {
        //搜索功能
        $("#search").click(function() {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('
            index ')}');
        //点击排序
        $('.list_sort').click(function() {
            var url = $(this).attr('url');
            var ids = $('.ids:checked');
            var param = '';
            if (ids.length > 0) {
                var str = new Array();
                ids.each(function() {
                    str.push($(this).val());
                });
                param = str.join(',');
            }

            if (url != undefined && url != '') {
                window.location.href = url + '/ids/' + param;
            }
        });
    });
    </script>
</block>

